package com.cddx.logistics.controller;

import com.cddx.logistics.domain.vo.MaterialInOutStatisticsVo;
import com.cddx.logistics.service.MaterialInOutStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

@RestController
@RequestMapping("/stats/material")
public class MaterialInOutStatsController {

    @Autowired
    private MaterialInOutStatsService statsService;

    @GetMapping("/in-out")
    public List<MaterialInOutStatisticsVo> getInOutStats(
            @RequestParam String type,
            @RequestParam(required = false) String materialName,
            @RequestParam(required = false) String materialCode) {

        return statsService.getMaterialInOutStats(type, materialName, materialCode);
    }
}
